<?php

namespace App\Repositories;

use Prettus\Repository\Eloquent\BaseRepository;
use Prettus\Repository\Criteria\RequestCriteria;
use App\Repositories\StaffRepository;
use App\Models\Staff;
use App\Validators\StaffValidator;

/**
 * Class StaffRepositoryEloquent.
 *
 * @package namespace App\Repositories;
 */
class StaffRepositoryEloquent extends BaseRepository implements StaffRepository
{
    /**
     * Specify Model class name
     *
     * @return string
     */
    public function model()
    {
        return Staff::class;
    }

    

    /**
     * Boot up the repository, pushing criteria
     */
    public function boot()
    {
        $this->pushCriteria(app(RequestCriteria::class));
    }

    protected $fieldSearchable = [
        'name'=>'like',
        'id_card',
        'card_num',
        'department_id',
        'staff_position_id',
        'dorm.building_id',
        'dorm.unit_name',
        'dorm.code'
    ];

    public function batchUpdate($arr,$department_id){
        print_r($arr['ids']);
        $this->model->where('department_id',$department_id)->whereIn('id',$arr['ids'])->update($arr['updateData']);
    }

}
